fix: Adjust payload format for PHP endpoints#467
Conversation
|
|
||
| router.Handle("/all", GetProjectKeyFromAuthorizationHeader(http.HandlerFunc(StreamServerAllPayload))) | ||
|
|
||
| router.PathPrefix("/sdk/flags/{flagKey}"). |
There was a problem hiding this comment.
The GetServerFlags method already has a branch of logic that handles the individual flag request if the flagKey variable is set. However, we never defined that route so the variable would in fact get set.
| } | ||
| } else { | ||
| body = ServerAllPayloadFromFlagsState(allFlags) | ||
| body = ServerFlagsFromFlagsState(allFlags) |
There was a problem hiding this comment.
For PHP, the /sdk/flags endpoint should return only the flags in an array, not the full flags + segments payload.
There was a problem hiding this comment.
Oh wait a sec. Will this break non-php sdks? I think we need this to have a 3rd case where we do just flags and not all?
There was a problem hiding this comment.
I don't believe this is a problem. This function only serves two routes -- /sdk/flags/{flagKey} and /sdk/flags.
These are routes that should exclusively be used by PHP SDKs. Non-PHP SDKs don't make flag only requests such as these.
I think we need this to have a 3rd case where we do just flags and not all?
Line 25 is serves all flags. Line 20 serves a single flag (assuming the flag key parameter is set).
The /all endpoint is serviced by the StreamServerAllPayload handler.
There was a problem hiding this comment.
The /all endpoint is serviced by the StreamServerAllPayload handler.
Ahhh, OK. Cool. I forgot about that.
No description provided.